import { ref } from 'vue';

export interface PaginationProps {
  page?: number;
  itemCount?: number;
  pageSize?: number;
  pageSizes?: number[];
  showSizePicker?: boolean;
  showQuickJumper?: boolean;
}

export function usePagination(config?: Partial<PaginationProps>) {
  const pagination = ref<PaginationProps>({
    pageSizes: [10, 20, 30, 40, 50],
    pageSize: 10,
    showSizePicker: true,
    showQuickJumper: true,
    itemCount: 0,
    page: 1,
    ...config,
  });

  const setPagination = (value: Partial<PaginationProps>) => {
    pagination.value = {
      ...pagination.value,
      ...value,
    };
  };

  return { pagination, setPagination };
}
